<!--
 * @Author: daidai
 * @Date: 2022-03-01 09:43:37
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-09-09 11:40:22
 * @FilePath: \web-pc\src\pages\big-screen\view\indexs\left-bottom.vue
-->
<template>
  <div
    class="left_boottom_wrap flex-col"
    :class="{ 'overflow-y-auto': !sbtxSwiperFlag }"
  >
    <div class="text-wrapper_54 flex-row">
      <div class="text_351">部门</div>
      <div class="text_352">月份</div>
      <div class="text_353">到期数/完成数</div>
    </div>
    <component
      class="scrollc beautify-scroll-def"
      :style="'height:' + height + 'px' "
      :is="components"
      :data="list"
      :class-option="defaultOption"
    >
      <ul>
        <template v-for="(item, i) in list">
          <li class="text-wrapper_55 flex-row" :key="i">
            <div class="text_354">{{item.department}}</div>
            <div class="text_355">6月</div>
            <div class="text_356">{{item.dueCount}}/{{item.completedCount}}</div>
          </li>
        </template>
      </ul>
    </component>
  </div>

  <!-- <Reacquire v-else @onclick="getData" style="line-height: 200px" /> -->
</template>

<script>
import { currentGET } from "api";
import vueSeamlessScroll from "vue-seamless-scroll"; // vue2引入方式
import Kong from "@/components/kong.vue";
export default {
  props: {
    data: {
      type: Array,
      default: () => [],
    },
    height: {
      type: Number,
      default: 120,
    }
  },
  components: { vueSeamlessScroll, Kong },
  data() {
    return {
      list: [],
      pageflag: true,
      components: vueSeamlessScroll,
      defaultOption: {
        ...this.$store.state.setting.defaultOption,
        singleHeight: 90,
        limitMoveNum: 5,
        step: 0,
      },
    };
  },
  computed: {
    sbtxSwiperFlag() {
      let sbtxSwiper = this.$store.state.setting.sbtxSwiper;
      if (sbtxSwiper) {
        this.components = vueSeamlessScroll;
      } else {
        this.components = Kong;
      }
      return sbtxSwiper;
    },
  },
  created() {},

  mounted() {
    this.getData(this.data);
  },
  watch: {
    data: {
      handler(val) {
        this.getData(val);
      },
      deep: true,
    },
  },
  methods: {
    getData(val = []) {
      const list = [...val]
      list.forEach(item => {
          item.dueCount = Number(item.dueCount || 0).toFixed(0)
          item.completedCount = Number(item.completedCount || 0).toFixed(0)
        });
        // list.sort((a,b) => b.completionValue - a.completionValue)
        this.list = list;
        let timer = setTimeout(() => {
          clearTimeout(timer);
          this.defaultOption.step =
            this.$store.state.setting.defaultOption.step;
        }, this.$store.state.setting.defaultOption.waitTime);
    },
  },
};
</script>
<style lang="scss" scoped>
.left_boottom_wrap {
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.doudong {
  //  vertical-align:middle;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -ms-backface-visibility: hidden;
  backface-visibility: hidden;
}
.flex-col {
  display: flex;
  flex-direction: column;
}
.flex-row {
  display: flex;
  flex-direction: row;
}
.scrollc {
  height: 120px;
  overflow-y: auto;
}

.overflow-y-auto {
  overflow-y: auto;
}

.text-wrapper_54 {
  background-color: rgba(6, 54, 112, 1);
  width: 414px;
  height: 30px;
  margin: 19px 0 0 12px;
  .text_351 {
    width: 25px;
    height: 17px;
    overflow-wrap: break-word;
    color: rgba(96, 127, 181, 1);
    font-size: 12px;
    letter-spacing: 0.22499999403953552px;
    font-weight: normal;
    text-align: left;
    white-space: nowrap;
    line-height: 17px;
    margin: 7px 0 0 40px;
  }
  .text_352 {
    width: 25px;
    height: 17px;
    overflow-wrap: break-word;
    color: rgba(96, 127, 181, 1);
    font-size: 12px;
    letter-spacing: 0.22499999403953552px;
    font-weight: normal;
    text-align: left;
    white-space: nowrap;
    line-height: 17px;
    margin: 7px 0 0 126px;
  }
  .text_353 {
    width: 80px;
    height: 17px;
    overflow-wrap: break-word;
    color: rgba(96, 127, 181, 1);
    font-size: 12px;
    letter-spacing: 0.22499999403953552px;
    font-weight: normal;
    text-align: left;
    white-space: nowrap;
    line-height: 17px;
    margin: 7px 57px 0 61px;
  }
}

.text-wrapper_55 {
  background-color: rgba(4, 47, 115, 1);
  width: 414px;
  height: 30px;
  margin-left: 12px;
  div{
    overflow: hidden;
  }
  .text_354 {
    width: 164px;
    height: 17px;
    overflow-wrap: break-word;
    color: rgba(102, 255, 255, 1);
    font-size: 12px;
    letter-spacing: 0.22499999403953552px;
    font-weight: normal;
    text-align: left;
    white-space: nowrap;
    line-height: 17px;
    margin: 7px 0 0 26px;
  }
  .text_355 {
    width: 25px;
    height: 17px;
    overflow-wrap: break-word;
    color: rgba(102, 255, 255, 1);
    font-size: 12px;
    letter-spacing: 0.22499999403953552px;
    font-weight: normal;
    text-align: center;
    white-space: nowrap;
    line-height: 17px;
    margin: 7px 0 0 0;
  }
  .text_356 {
    width: 80px;
    height: 17px;
    overflow-wrap: break-word;
    color: rgba(78, 232, 152, 1);
    font-size: 12px;
    letter-spacing: 0.22499999403953552px;
    font-weight: normal;
    text-align: center;
    white-space: nowrap;
    line-height: 17px;
    margin: 6px 0 0 63px;
  }
}
</style>
